import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.5

Window {
    width: 1024
    height: 650
    visible: true
    title: qsTr("BasicDemo")
    ListModel {
        id: deviceListModel
    }
    Row {
        Column {
            ComboBox {
                id: comboBoxDeviceList
                width: 800
                height: 50
                model: deviceListModel
            }
            Image {
                id:imageFrame
                width: 800
                height: 600
                function refresh() {
                    source = "image://myImageProvider?id=0"
                }
            }
        }
        Column{
            GroupBox {
                title: "初始化"
                Column {
                    Button {
                        text: "查找设备"
                        width: 200
                        onClicked: {
                            mySDK.scanDevice()
                        }
                    }
                    Row {
                        Button {
                            text: "打开设备"
                        }
                        Button {
                            text: "关闭设备"
                        }
                    }
                }
            }
            GroupBox {
                title: "图像采集"
                Column {
                    Row {
                        RadioButton {
                            text: "连续模式"
                        }
                        RadioButton {
                            text: "触发模式"
                        }
                    }
                    Row {
                        Button {
                            text: "开始采集"
                        }
                        Button {
                            text: "停止采集"
                        }
                    }
                    Row {
                        CheckBox {
                            text: "软触发"
                            width: 100
                        }
                        Button {
                            text: "软触发一次"
                        }
                    }
                }
            }
            GroupBox {
                title: "图片保存"
                Column {
                    Row {
                        Button {
                            text: "保存BMP"
                        }
                        Button {
                            text: "保存JPG"
                        }
                    }
                    Row {
                        Button {
                            text: "保存TFF"
                        }
                        Button {
                            text: "保存PNG"
                        }
                    }
                }
            }
            GroupBox {
                title: "参数"
                Column {
                    Row {
                        Text {
                            text: "曝光"
                            width: 100
                        }
                        TextInput {
                            width: 100
                        }
                    }
                    Row {
                        Text {
                            text: "增益"
                            width: 100
                        }
                        TextInput {
                            width: 100
                        }
                    }
                    Row {
                        Text {
                            text: "帧数"
                            width: 100
                        }
                        TextInput {
                            width: 100
                        }
                    }
                    Row {
                        Text {
                            text: "像素格式"
                            width: 100
                        }
                        TextInput {
                            width: 100
                        }
                    }
                    Row {
                        Button {
                            text: "参数获取"
                        }
                        Button {
                            text: "参数设置"
                        }
                    }
                }
            }
            GroupBox {
                title: "辅助线绘制"
                Row{
                    Button {
                        text: "圆形辅助线"
                    }
                    Button {
                        text: "线形辅助线"
                    }
                }
            }
        }
    }
    Connections {
        target: mySDK
        function onShowDeviceList(deviceList) {
            deviceListModel.clear()
            for (var i = 0; i < deviceList.length; i++)
            {
                deviceListModel.append({name: deviceList[i]})
            }
            comboBoxDeviceList.currentIndex = 0
        }
        function onRefreshImage() {
            imageFrame.refresh()
        }
    }
}
